﻿<%@ Page Title="" Language="C#" MasterPageFile="ReconSite.Master" AutoEventWireup="true" CodeBehind="BankMaster.aspx.cs" Inherits="Recon.Portal.WebUI.BankMaster" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<asp:Content ID="TitleContent" ContentPlaceHolderID="TitleHolder" runat="server">
    <title>Bank Master</title>
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="BodyHolder" runat="server">
    <div class="formDiv" style="width:60%">
    <h2 class="formTitle">Bank Master</h2>
    <h1 class="formError" style="text-align:right;font-size:smaller;color:#CC2900;">Fields marked with * are mandatory</h1>
	<%--<span id="mandatoryMessage" class="formError">Fields marked with * are mandatory</span>--%>
    <table cellspacing="1" cellpadding="1" border="0" width = "100%">
       <%--<tr>
                <td align="right">
                    Option<span class="required">*</span></td>
                <td  colspan="3">                    
                    <asp:RadioButtonList ID="rbOption" runat="server" RepeatDirection="Horizontal" 
                        RepeatLayout="Flow" AutoPostBack="True" 
                        onselectedindexchanged="rbOption_SelectedIndexChanged">
                    <asp:ListItem Value="1" Selected="True">Add</asp:ListItem>
                    <asp:ListItem Value="2">Modify</asp:ListItem>
                    </asp:RadioButtonList>
                    </td>
        </tr>--%>
             
        <tr>
            <td align="right">
                Bank ID<span class="required">*</span>
            </td>
            <td colspan="3">
                <asp:TextBox ID="txtBankID" runat="server" MaxLength="100"></asp:TextBox>
               <%-- <asp:Button ID="bntbrowse" runat="server" Text="..." Width="25px"   OnClick="bntbrowse_Click" CausesValidation="False" />
                <asp:Button ID="bntgetdetails" runat="server" Text="Get Details" OnClick="bntgetdetails_Click" CausesValidation="False" OnClientClick="javascript:return SelectUser();" />--%>
               <asp:RequiredFieldValidator ID="reqBankID" runat="server" 
                    ErrorMessage="Bank ID is mandatory" CssClass="formError"
                    ControlToValidate="txtBankID" SetFocusOnError="True"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="regBankID" runat="server" 
                    ErrorMessage="Invalid Bank ID" CssClass="formError"
                    ControlToValidate="txtBankID" SetFocusOnError="True" 
                    ValidationExpression="^[a-zA-Z0-9]+$"></asp:RegularExpressionValidator>
                
            </td>
            
        </tr>
        <tr>
            <td align="right">
            Name<span class="required">*</span>
            </td>
            <td colspan="3">
                <asp:TextBox ID="txtName" runat="server" MaxLength="100" Width = 300></asp:TextBox>
               <asp:RequiredFieldValidator ID="reqName" runat="server" 
                    ErrorMessage="Bank Name is mandatory" CssClass="formError"
                    ControlToValidate="txtName" SetFocusOnError="True"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="regName" runat="server" 
                    ErrorMessage="Invalid name" CssClass="formError"
                    ControlToValidate="txtName" SetFocusOnError="True" 
                    ValidationExpression="^[a-zA-Z' '.]+$"></asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td align="right">
                Bank IFSC<span class="required">*</span>
            </td>
            <td colspan="3">
            
                <asp:TextBox ID="txtBankIFSC" runat="server" MaxLength="4" Width = 300></asp:TextBox>
               <asp:RequiredFieldValidator ID="reqIFSC" runat="server" 
                    ErrorMessage="Bank IFSC is mandatory" CssClass="formError"
                    ControlToValidate="txtBankIFSC" SetFocusOnError="True"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="regIFSC" runat="server" 
                    ErrorMessage="Invalid IFSC" CssClass="formError"
                    ControlToValidate="txtBankIFSC" SetFocusOnError="True" 
                    ValidationExpression="^[a-zA-Z]+$"></asp:RegularExpressionValidator>
            </td>
        </tr>

        <tr>
            <td align="right">
            </td>
            <td  colspan="3">
                
                <asp:CheckBox ID="chkIsenabled" runat="server" Checked="True" Text="Enable" />
                
            </td>
        </tr>
       
        <tr>
            <td >
                &nbsp;
            </td>
            <td  colspan="3">
                <asp:Button ID="btnSubmit" runat="server" Text="Add" onclick="btnSubmit_Click"/>
                &nbsp;&nbsp;<asp:Button ID="btnCancel" runat="server" Text="Reset" CausesValidation="False" 
                     onclick="btnCancel_Click" />
            </td>
        </tr>

           </table>
         <div style="height:140px; width:100%; overflow:auto;">
                <asp:GridView ID="gvCustomer" runat="server" AllowPaging="false" 
                        AutoGenerateColumns="False" Width="100%"
                        HeaderStyle-BackColor="silver" HeaderStyle-ForeColor="#6f788f" 
                            HeaderStyle-Font-Bold="false" OnRowDeleting="gvCustAccount_RowDeleting">
                    <EmptyDataTemplate>
                        <asp:Label ID="lblNoRows" runat="server" Text="No records found for customer account detail." />
                    </EmptyDataTemplate>
                    <Columns>
                        <asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:LinkButton  ID = "lnkSelect" runat="server"  Text = "Select"  CausesValidation="false" CommandName="Select"></asp:LinkButton>
                            </ItemTemplate>
                          </asp:TemplateField>
                        <asp:TemplateField HeaderText="Bank ID" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Label  ID = "lblBankID" runat="server" Text='<%# Eval("BankID") %>' ></asp:Label>
                            </ItemTemplate>
                          </asp:TemplateField>
                        <asp:TemplateField HeaderText="Name" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Label  ID = "lblBankName" runat="server" Text='<%# Eval("BankName") %>' ></asp:Label>
                            </ItemTemplate>
                          </asp:TemplateField>
                        <asp:TemplateField HeaderText="Bank IFSC" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Label  ID = "lblBankIFSC" runat="server" Text='<%# Eval("BankIFSC") %>' ></asp:Label>
                            </ItemTemplate>
                          </asp:TemplateField>
                        <asp:TemplateField HeaderText="Enabled?" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Label  ID = "lblIsEnabled" runat="server"  Text='<%# Eval("IsEnabled") %>'></asp:Label>
                            </ItemTemplate>
                          </asp:TemplateField>
                        <asp:CommandField HeaderText="Delete" ShowDeleteButton="True" ItemStyle-HorizontalAlign="Center"/>
                    </Columns>
                </asp:GridView>
                </div>
   <asp:UpdatePanel ID="upUnmatchedLists" runat="server" UpdateMode="Conditional">
        <ContentTemplate>    
                <div id="pnlMatchList" runat="server" class="pnlMatchList">    
                    <span style="azimuth: center;">
                        <div id="Div1" class="formDiv" runat ="server"  >
                            <center>
                                <asp:Label ID="lblMessage" runat="server"    CssClass="lable"/>
                            </center>
                        </div>
                    </span>
                    <div class="formDiv" style="width: 30%;">
                         <center>
                            <asp:Button ID="btnok" runat="server" Text="OK" onclick="btnok_Click" CausesValidation="False"  />
                          </center>
                    </div>
                </div>
            <div style="display: none">
                <asp:Button ID="btnManualPopup" runat="server" />
            </div>
            <ajax:ModalPopupExtender ID="btnClickPopup" runat="server" PopupControlID="pnlMatchList"
                TargetControlID="btnManualPopup" BackgroundCssClass="modalBackground" RepositionMode="RepositionOnWindowScroll" OkControlID = "btnok">
            </ajax:ModalPopupExtender>   
        </ContentTemplate>        
    </asp:UpdatePanel>
           </div>

           <script type="text/javascript">
               $(function () {
                   $("[id*=lnkSelect]").click(function () {
                       var tr = $(this).closest('tr');
                       var bankid = $(tr).find('span[id*="lblBankID"]').text();
                       var bankname = $(tr).find('span[id*="lblBankName"]').text();
                       var ifsc = $(tr).find('span[id*="lblBankIFSC"]').text();
                       var isEnable = $(tr).find('span[id*="lblIsEnabled"]').text();

                       $("#<%= txtBankID.ClientID %>").val(bankid).text();
                 $("#<%= txtName.ClientID %>").val(bankname).text();
                 $("#<%= txtBankIFSC.ClientID %>").val(ifsc).text();

                       var btntext = "Modify";
                       $("#<%= btnSubmit.ClientID %>").val(btntext).text();

                 if (isEnable.toString() == "True") {
                     $("#<%= chkIsenabled.ClientID %>").prop('checked', true);
                }
                else { $("#<%= chkIsenabled.ClientID %>").prop('checked', false); }
                       return false;

                       
             });
               });


               function SelectUser() {
                   var Username = document.getElementById('<%=txtBankID.ClientID %>').value;
                    if (Username == '') {
                        alert("Bank Id is Mandatory");
                        return false;
                    }

                    return true;
                }
                </script>
</asp:Content>
